package com.kksoft.readcm.a;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import com.kksoft.readcm.activity.App;
import com.kksoft.readcm.b.j;
import com.kksoft.readcm.objects.aa;
import com.kksoft.readcm.objects.ai;
import com.kksoft.readcm.objects.GlobalVar;

import java.util.concurrent.ConcurrentHashMap;

public final class ah extends AppObservable
{
  private final aa k=null;
  private final Bitmap l;
  private ConcurrentHashMap m;
  private ConcurrentHashMap n;
  private ConcurrentHashMap o;
  private ai p;

  public ah()
  {
    ConcurrentHashMap localConcurrentHashMap1 = new ConcurrentHashMap();
    this.m = localConcurrentHashMap1;
    ConcurrentHashMap localConcurrentHashMap2 = new ConcurrentHashMap();
    this.n = localConcurrentHashMap2;
    ConcurrentHashMap localConcurrentHashMap3 = new ConcurrentHashMap();
    this.o = localConcurrentHashMap3;
    Handler localHandler = App.s();
    ai localai = new ai(localHandler, 5000L);
    this.p = localai;
    Bitmap localBitmap = ((BitmapDrawable)App.getAppThis().getResources().getDrawable(2130837530)).getBitmap();
    this.l = localBitmap;
    //aa localaa = new aa(2, 2);
    //this.k = localaa;
  }

  public final Bitmap a(String paramString)
  {
    Bitmap localBitmap = (Bitmap)this.m.get(paramString);
    if (localBitmap != null);
    while (true)
    {
      return localBitmap;
      //if ((this.m.size() <= 700) && (!this.n.containsKey(paramString)))
      //{
        //ConcurrentHashMap localConcurrentHashMap = this.o;
        //Boolean localBoolean = Boolean.valueOf("1");
        //if (localConcurrentHashMap.putIfAbsent(paramString, localBoolean) == null)
        //{
         // aa localaa = this.k;
         // String str = this.i.b(paramString);
          //j localj = new j(paramString, str, this);
          //localaa.a(localj);
        //}
     // }
     // localBitmap = this.l;
    }
  }

  public final void a()
  {
    this.n.clear();
    ItemAppObservable locale = this.c;
    String[] arrayOfString = new String[0];
    locale.a("DELETE FROM failed_hosts", arrayOfString);
    this.c.d();
  }

  public final void a(Bitmap paramBitmap, String paramString, boolean paramBoolean)
  {
    Object localObject1 = this.o.remove(paramString);
    if (paramBitmap == null)
      if (paramBoolean)
      {
        ConcurrentHashMap localConcurrentHashMap1 = this.n;
        //Boolean localBoolean = Boolean.valueOf(1);
        //Object localObject2 = localConcurrentHashMap1.put(paramString, localBoolean);
        ItemAppObservable locale = this.c;
        String[] arrayOfString = new String[1];
        arrayOfString[0] = paramString;
        locale.a("REPLACE INTO failed_hosts (host) VALUES (?)", arrayOfString);
        ai localai = this.p;
        //an localan = new an(this);
        //localai.a(localan);
      }
    while (true)
    {
      return;
      //ConcurrentHashMap localConcurrentHashMap2 = this.m;
      //String str = paramString.toString();
      //Object localObject3 = localConcurrentHashMap2.put(str, paramBitmap);
      //h localh = new h(paramString);
      //this.h.a(localh);
    }
  }

  public final void i()
  {
    super.i();
    this.k.c();
  }
}